<template>
  <div class="header">
    <el-form ref="form" :model="form">
      <div class="search">
        <el-form-item label="审核状态" class="label">
          <el-select placeholder="请选择审核状态" class="input" />
        </el-form-item>
        <el-form-item label="姓名" class="label">
          <el-input v-model="form.name" class="input" placeholder="请输入姓名" />
        </el-form-item>
        <el-form-item label="身份证号" class="label">
          <el-input v-model="form.name" class="input" placeholder="请输入身份证号" />
        </el-form-item>
        <el-form-item label="单元-门牌" class="label">
          <el-input v-model="form.name" class="input" placeholder="请输入单元-门牌" />
        </el-form-item>

        <el-form-item>
          <el-button type="primary" size="mini" @click="onSubmit">查询</el-button>
        </el-form-item>
      </div>
    </el-form>
    <!-- 表格区域 -->
    <el-table
      :data="tableData"
      style="width: 100%"
      :header-cell-style="{background:'#ebecf0',color:'#3b3c3c'}"
     >
      <el-table-column type="index" label="序号" width="100" />
      <el-table-column prop="name" label="姓名" />
      <el-table-column prop="door" label="身份证" />
      <el-table-column prop="person" label="电话" />
      <el-table-column prop="time" label="小区名" />
      <el-table-column prop="time" label="单元-门牌" />
      <el-table-column prop="time" label="卧室" />
      <el-table-column prop="time" label="居住类型" />
      <el-table-column label="审核状态">
        <template slot-scope="scope">
          <el-link type="warning" v-if="scope.row.status===0">待审核</el-link>
          <el-link type="success" v-else-if="scope.row.status===1">已通过</el-link>
          <el-link type="danger" v-else-if="scope.row.status===2">未通过</el-link>
        </template>
      </el-table-column>
      <el-table-column prop="time" label="提交时间" />
      <el-table-column label="操作"  width="100">
        <template slot-scope="scope">
          <el-button type="text" @click="showdialog(scope.row)">{{ scope.row.option==='0'?'审核':'查看' }}</el-button>
        </template>
      </el-table-column>
    </el-table>
    <!-- 分页 -->
    <div class="pagination">
      <el-pagination
        :current-page.sync="page"
        background
        :page-sizes="[10, 20, 30, 40]"
        layout="total, prev, pager, next, jumper"
        :total="total"
        @current-change="handleCurrentChange"
      />
    </div>
    <!-- 物业审核对话框对话框 -->

    <el-dialog width="55%" title :visible.sync="dialogFormVisible" class="doorcheck">
      <div class="dialog_box">
        <div class="dialog_content">
          <div class="dialog_title">门禁信息</div>

          <el-form ref="form" :inline="true" :model="detail">
            <el-row :gutter="20">
              <el-col :span="8">
                <el-form-item label="姓名" class="label">
                  <el-input v-model="detail.name" class="input" />
                </el-form-item>
              </el-col>
              <el-col :span="10" :offset="4">
                <el-form-item label="电话" class="label">
                  <el-input v-model="detail.phone" class="input" />
                </el-form-item>
              </el-col>
            </el-row>
            <el-row :gutter="20">
              <el-col :span="8">
                <el-form-item label="证件类型" class="label">
                  <el-input v-model="detail.type" class="input" />
                </el-form-item>
              </el-col>
              <el-col :span="10" :offset="4">
                <el-form-item label="证件号码" class="label">
                  <el-input v-model="detail.phone" class="input" />
                </el-form-item>
              </el-col>
            </el-row>
            <el-row :gutter="20">
              <el-col :span="8">
                <el-form-item label="单元-门牌" class="label">
                  <el-input v-model="detail.door" class="input" />
                </el-form-item>
              </el-col>
              <el-col :span="10" :offset="4">
                <el-form-item label="卧室号" class="label">
                  <el-input v-model="detail.room" class="input" />
                </el-form-item>
              </el-col>
            </el-row>
            <el-row :gutter="20">
              <el-col :span="8">
                <el-form-item label="居住类型" class="label">
                  <el-input v-model="detail.type" class="input" />
                </el-form-item>
              </el-col>
              <el-col :span="10" :offset="4">
                <el-form-item label="性别" class="label">
                  <el-input v-model="detail.sex" class="input" />
                </el-form-item>
              </el-col>
            </el-row>
            <el-row :gutter="20">
              <el-col :span="8">
                <el-form-item label="头像图片" class="label">
                  <el-image
                    style="width: 130px; height: 130px"
                    :src="url"
                    :fit="fit"
                    :preview-src-list="srcList"
                  />
                </el-form-item>
              </el-col>
              <el-col :span="10" :offset="4">
                <el-form-item label="证件照片" class="label">
                  <el-image
                    style="width: 130px; height: 130px"
                    :src="url"
                    :fit="fit"
                    :preview-src-list="srcList"
                  />
                </el-form-item>
              </el-col>
            </el-row>
            <el-row :gutter="20">
              <el-col :span="10">
                <el-form-item label="证明材料" class="label">
                  <el-input v-model="detail.material" class="material" />
                </el-form-item>
              </el-col>
            </el-row>
          </el-form>
        </div>
        <div class="dialog_content">
          <div class="dialog_title">审核信息</div>

          <el-form ref="form" :inline="true" :model="detail">
            <el-row :gutter="20">
              <el-col :span="10">
                <el-form-item label="门禁权限" class="label doorfather">
                  <el-input class="power" v-model="detail.power"></el-input>
                  <span class="el-icon-arrow-down icons" @click="powerdialogVisible=true"></span>
                </el-form-item>
              </el-col>
            </el-row>
            <el-row :gutter="20">
              <el-col :span="10">
                <el-form-item label="审核备注" class="label">
                  <el-input
                    v-model="detail.applyer"
                    type="textarea"
                    placeholder="输入审核备注"
                    class="textareas"
                  />
                </el-form-item>
              </el-col>
            </el-row>
          </el-form>
        </div>
      </div>
      <span slot="footer" class="dialog-footer">
        <el-button @click="dialogFormVisible = false">不通过</el-button>
        <el-button type="primary" @click="dialogFormVisible = false">通过</el-button>
      </span>
    </el-dialog>
    <!-- 门禁权限对话框 -->
    <el-dialog  title="请勾选房屋的单元号" :visible.sync="powerdialogVisible" width="30%">
      <el-tree
        :data="doorList"
        :props="treeprops"
        show-checkbox
        default-expand-all
        :default-checked-keys="detail.powerdialogVisible"
        ref="treeRef"
      ></el-tree>
      <span slot="footer" class="dialog-footer">
        <el-button type="primary" @click="dialogVisible = false">选中返回</el-button>
      </span>
    </el-dialog>
  </div>
</template>

<script>
export default {
  name: "Door",
  components: {},
  data() {
    return {
      form: {},
      tableData: [
        {
          time: "2016-05-02",
          name: "弄堂加油",
          door: "1888",
          person: "jyb",
          option: "0",
          status: 0
        },
        {
          time: "2016-05-02",
          name: "弄堂加油",
          door: "1888",
          person: "jyb",
          option: "1",
          status: 1
        },
        {
          time: "2016-05-02",
          name: "弄堂加油",
          door: "1888",
          person: "jyb",
          option: "1",
          status: 2
        }
      ],
      total: 100,
      page: 10,
      dialogFormVisible: false,
      detail: {
        material: "点击查看",
        sex: "男",
        type: "自住",
        room: 2003,
        door: 12,
        phone: 18888,
        name: "mick",
        power: []
      },
      powerdialogVisible: false,
      treeProps: {
        children: "children",
        label: "label"
      },
      doorList: [
        {
          label: "新丰苑三期",
          children: [
            {
              label: 0
            },
            {
              label: 1
            },
            {
              label: 2
            },
            {
              label: 3
            },
            {
              label: 4
            }
          ]
        }
      ],
      url:
        "https://fuss10.elemecdn.com/e/5d/4a731a90594a4af544c0c25941171jpeg.jpeg"
    };
  },
  computed: {},
  watch: {},
  created() {},
  methods: {
    showdialog() {
      this.dialogFormVisible = true;
    }
  }
};
</script>
<style lang="scss" scoped>
.header {
  background: #ffffff;
  padding: 25px;
  padding-bottom: 100px;
  min-height: 800px;
  position: relative;
  .search {
    display: flex;
    align-items: flex-end;
    border-bottom: 2px solid #dcdee3;
    margin-bottom: 30px;
  }
  .input {
    width: 370px;
  }
  .label {
    margin-right: 20px;
    color: #666666;
    font-size: 14px;
  }
  .pagination {
    position: absolute;
    right: 0;
    bottom: 0;
    margin: 50px;
  }
  .material {
    width: 700px !important;
  }
  .select {
    width: 900px !important;
  }
  .textareas {
    width: 700px !important;
  }
  .power {
    width: 700px;
  }
}
.doorfather {
  position: relative;
  .icons {
    position: absolute;
    display: block;
    width: 20px;
    height: 20px;
    right: 10px;
    top: 11px;
  }
}

.dialog-footer {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 18px;
  margin-top: 8px;
}
</style>
<style scoped>
.doorcheck /deep/.el-dialog__header {
  padding:5px!important;
}
.doorcheck /deep/.el-dialog__body {
  padding: 20px 15px!important;
}
</style>
